export default {
    setUserName(state, name) {//修改用户名
        state.userName = name;
        localStorage.setItem('userName-app', name);
    },
    setIsBindDoctor(state, did) {//绑定医生
        state.isBindDoctor = did;
        localStorage.setItem('isBindDoctor-app', did);
    },
    // setIsRecord(state, recordMsg) {//记录发作次数
    //     state.isRecord = recordMsg;
    //     localStorage.setItem('isRecord-app', recordMsg)
    // },
    loginSuccess(state, data) {//登录成功
        state.isLogin = true;
        state.loginUserInfo = data;
        state.isBindDoctor = data.did;
        state.userPhone = data.phone;
        state.userMoney = data.money;//用户的钱
        state.userName = data.name;
        localStorage.setItem('userName-app', data.name);
        localStorage.setItem('isBindDoctor-app', data.did);
        localStorage.setItem('userMsg_app', JSON.stringify(data));
        localStorage.setItem('isLogin_app', true);
        localStorage.setItem('userMoney-app', data.money);
        localStorage.setItem('userPhone-app', data.phone)
    },
    setToken(state, token) {
        state.token = token;
        localStorage.setItem('userToken_app', token)
    },
    outLogin(state) {//退出登录
        state.isLogin = false;
        state.loginUserInfo = '';
        state.token = '';
        localStorage.removeItem('userMsg_app');
        localStorage.setItem('isLogin_app', false);
    },
    setUserMoney(state, money) {//设置VIP
        state.userMoney = money;
        localStorage.setItem('userMoney-app', money);
    }
}
